fix(pat-tinymce): Add support for image scales as fallback for picture variants. - #1496
fix(pat-tinymce): Add support for image scales as fallback for picture variants.#1496thet wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds fallback support for Plone 5 image scales in TinyMCE when picture variants are not configured, addressing compatibility issues for sites migrated from Plone 5 to Plone 6.
- Adds backward compatibility for image scales when picture variants are unavailable
- Updates image dialog template to conditionally render scale options based on available configuration
- Modifies link handling logic to support both picture variants and legacy image scales
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/pat/tinymce/tinymce--implementation.js |
Adds parsing logic for imageScales option as fallback when picture variants are not available |
src/pat/tinymce/templates/image.xml |
Updates template to conditionally render scale options for either picture variants or image scales |
src/pat/tinymce/js/links.js |
Implements fallback logic throughout the image handling workflow to support both picture variants and legacy scales |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…e variants.
picture variants are a new feature in Plone 6. Migrated sites from Plone
5 have not used that, but still contain the "data-scale" instead of the
"data-picturevariant" attributes in TinyMCE edited texts.
When opening the image dialog existing pictures have no size variant
preselected.
This PR fixes that and falls back to the image scale selection.
The fallback is activated when no picture variants are configured e.g.
by setting the picture variants field in the imaging controlpanel
to "{}".
cd81355 to
ed65782
Compare
|
Wouldn't it be better to fix the content in an upgrade step? I think in collective.exportimport this is implemented, as we use that for university migration. This way the content is updates and we don't need to make things more complicated. Thought's? |
|
I think it is better to fix the content. |
|
I'd also fix the content instead. We've used this module https://github.com/collective/collective.exportimport/blob/main/src/collective/exportimport/fix_html.py a lot and also implemented our own upgrade step to fix |
|
Yes, thinking about this option. |
|
I used an upgrade step using collective.exportimport.fix_html |
picture variants are a new feature in Plone 6. Migrated sites from Plone 5 have not used that, but still contain the "data-scale" instead of the "data-picturevariant" attributes in TinyMCE edited texts. When opening the image dialog existing pictures have no size variant preselected.
This PR fixes that and falls back to the image scale selection. The fallback is activated when no picture variants are configured e.g. by setting the picture variants field in the imaging controlpanel to "{}".
This is an alternative implementation for: #1493